
$(function() {
    if (!window["WebSocket"]) {
    	alert("You browser is not support websocket");
    	return;
    }
	var wsuri = "ws://192.168.6.152/echo?email=test";
	window.onload = function() {
		var sock = null;
	    console.log("onload"+ " " + wsuri);
	    sock = new WebSocket(wsuri);
	
		sock.onopen = function() {
		    console.log("connected to " + wsuri);
		}
		sock.onclose = function(e) {
		    console.log("connection closed (" + e.code + ")");
		}
		
		sock.onmessage = function(e) {
		    console.log("message received: " + e.data);
		}
    };
	

});

function send() {
    var msg = $("#message").value;
    sock.send(msg);
};